#-*- coding: utf8 -*-
from tutor.scripts import *
from tutor.plugins.sympy import *

niter = 0
with display_block('Entradas'):
    while True:
        # Limite existe: composição de funções

        niter += 1
        answer = oneof(1, 2, 3, 4, 5, 6)
        alpha = oneof(x * y, x / 2 + y / 2, x * y ** 2, x ** 2 * y)
        A = alpha.subs([(x, 1), (y, 1)])

        n = oneof(1, 2)
        m = answer * n
        alphaM = alpha ** m
        alphaN = alpha ** n

        assert A == 1, (alpha, A)
        break

# Salva resposta
g0, g1, g2, g3, g4, g5, g6, g7 = [0] * 8
if answer is None:
    g7 = 1
else:
    locals()['g%s' % answer] = 1
    assert (answer in range(7))
    assert 1 in [ g0, g1, g2, g3, g4, g5, g6, g7 ]

# Mostra resultados
with display_block('Resultados'):
    answers = list(enumerate([ g0, g1, g2, g3, g4, g5, g6, g7 ]))

